package com.cncytech.safe_space_config_test;

import androidx.appcompat.app.AppCompatActivity;

import android.app.ActivityManager;
import android.content.Context;
import android.os.Bundle;
import android.widget.Button;
import android.widget.Toast;


public class QuitClearDataActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_quit_clear_data);

        Button clearData = (Button) findViewById(R.id.clear_Data);
        clearData.setOnClickListener(c -> {
            ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
            boolean result = am.clearApplicationUserData();
            if (!result) {
                Toast.makeText(this, "清除数据失败", Toast.LENGTH_SHORT).show();
            }
        });
    }
}